---
title: AttachmentRuntime
---

import { ParametersTable } from "@/components/docs";
import {
  ComposerAttachmentState,
  MessageAttachmentState,
} from "@/components/docs/parameters/context";

### `useAttachment`

Access the current attachment state:

```tsx
import { useAttachment } from "@assistant-ui/react";

const { attachment } = useAttachment();
const att = useAttachment((m) => m.attachment);
```

### `useComposerAttachment` (Composer)

When working with a composer’s attachment:

```tsx
import { useComposerAttachment } from "@assistant-ui/react";

const { attachment } = useComposerAttachment();
const composerAttachment = useComposerAttachment((m) => m.attachment);
```

<ParametersTable {...ComposerAttachmentState} />

### `useMessageAttachment` (Message)

For managing a message’s attachment:

```tsx
import { useMessageAttachment } from "@assistant-ui/react";

const { attachment } = useMessageAttachment();
const messageAttachment = useMessageAttachment((m) => m.attachment);
```

<ParametersTable {...MessageAttachmentState} />
